<template>
  <div class="home">
    <div class="header">
      <div class="header_nav">
        <div class="nav_l">
          <h3>源聚通</h3>
          <p>YuanJu Venture Capital</p>
        </div>
        <div class="nav_r">
          <img src="@/assets/img/home/qiandao.png" />
        </div>
      </div>
    </div>

    <div class="banner">
      <div class="swiper-container">
        <div class="swiper-wrapper">
          <div
            class="swiper-slide"
            v-for="(item, index) in images"
            :key="index"
          >
            <img class="swiper-img" :src="item" />
          </div>
        </div>
      </div>
      <div class="swiper-pagination"></div>
    </div>
    <div class="content">
      <div class="tip" @click="orderlist">
        <img
          class="icon"
          :src="require('@/assets/img/home/youliaocaifu.png')"
        />
        <p>户使用创宏APP！如有任何问题可随时咨询在线客服哦！</p>
      </div>
      <div class="model">
        <div class="model_l" @click="capitaldetails">
          <p>我要充值</p>
        </div>
        <div class="model_r">
          <div class="rt">
            <p>邀请好友</p>
          </div>
          <div class="rb" @click="calculator">
            <p>计算器</p>
          </div>
        </div>
      </div>
      <div class="list">
        <div class="cell">
          <div class="cell_l">
            <img src="@/assets/img/home/woyaochongzhi.png" />
          </div>
          <div class="cell_r">
            <p class="title">【新手专享】汽车电池研发生产项目</p>
            <p class="center">
              源聚通新项目限投1次，金额最高限制
              <span>200元</span>
            </p>
            <div class="jindu">
              <div class="progressbox">
                <div class="progress"></div>
              </div>
              <span>已售72%</span>
            </div>
            <div class="tagbox">
              <span>200起投</span>
              <span>项目周期1天</span>
              <span>每日分红2元</span>
            </div>
          </div>
        </div>
        <div class="cell">
          <div class="cell_l">
            <img src="@/assets/img/home/woyaochongzhi.png" />
          </div>
          <div class="cell_r">
            <p class="title">【新手专享】汽车电池研发生产项目</p>
            <p class="center">
              源聚通新项目限投1次，金额最高限制
              <span>200元</span>
            </p>
            <div class="jindu">
              <div class="progressbox">
                <div class="progress"></div>
              </div>
              <span>已售72%</span>
            </div>
            <div class="tagbox">
              <span>200起投</span>
              <span>项目周期1天</span>
              <span>每日分红2元</span>
            </div>
          </div>
        </div>
        <div class="cell">
          <div class="cell_l">
            <img src="@/assets/img/home/woyaochongzhi.png" />
          </div>
          <div class="cell_r">
            <p class="title">【新手专享】汽车电池研发生产项目</p>
            <p class="center">
              源聚通新项目限投1次，金额最高限制
              <span>200元</span>
            </p>
            <div class="jindu">
              <div class="progressbox">
                <div class="progress"></div>
              </div>
              <span>已售72%</span>
            </div>
            <div class="tagbox">
              <span>200起投</span>
              <span>项目周期1天</span>
              <span>每日分红2元</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div style="height: 50px"></div>
  </div>
</template>
<script>
import { Toast } from "vant";
import Swiper from "swiper";
import Fetch from "../../../utils/fetch";
import "swiper/dist/css/swiper.min.css";
export default {
  name: "home",
  components: {},
  computed: {},
  data() {
    return {
      images: [
        require("../../../assets/img/home/banner1.jpg"),
        require("../../../assets/img/home/banner2.jpg"),
        require("../../../assets/img/home/banner3.jpg"),
      ],
    };
  },

  mounted() {
    var swiper = new Swiper(".swiper-container", {
      effect: "coverflow",
      loop: true,
      grabCursor: true,
      centeredSlides: true,
      slidesPerView: "auto",
      autoplay: 3000,
      autoplayDisableOnInteraction: false,
      // 如果需要分页器
      pagination: ".swiper-pagination",
      paginationClickable: true,
      coverflow: {
        rotate: 10,
        stretch: 0,
        depth: 100,
        modifier: 1,
        slideShadows: false,
      },
      spaceBetween: 30,
    });
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      this.$axios({
        url: "/api/api/image",
        method: "get",
        params: {
          type: "banner",
        },
      })
        .then((res) => {})
        .catch((error) => {});
    },
    onClickLeft() {
      Toast("返回");
    },
    onClickRight() {
      Toast("按钮");
    },
    orderlist() {
      this.$router.push({
        path: "/orderlist",
        // query: {
        // },
      });
    },
    calculator() {
      this.$router.push({
        path: "/calculator",
        // query: {
        // },
      });
    },
    capitaldetails() {
      this.$router.push({
        path: "/capitaldetails",
        // query: {
        // },
      });
    },
  },
};
</script>

<style scoped lang="less">
.home {
  width: 100%;
  height: 100%;
  background: #ffffff;
  .header {
    background: url("../../../assets/img/home/header_bg.png") no-repeat;
    background-size: 100% 100%;
    width: 100%;
    height: 203px;
    .header_nav {
      padding: 15px;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
    }
    .nav_l {
      text-align: left;
      h3 {
        font-size: 16px;
        font-family: PingFangSC, PingFangSC-Semibold;
        font-weight: 600;

        color: #ffffff;
      }
      p {
        opacity: 0.61;
        font-size: 9px;
        font-family: Helvetica;
        color: #ffffff;
      }
    }
    .nav_r {
      img {
        width: 28px;
        height: 28px;
      }
    }
  }
  .banner {
    margin-top: -150px;
  }
  .content {
    background: #fdfdfd;
    margin-top: 15px;
    .tip {
      margin: 0 18px;
      background: #f7f7f9;
      border-radius: 4px;
      box-shadow: 0px 2px 12px 2px rgba(0, 0, 0, 0.06);
      overflow: hidden;
      margin-top: 10px;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      padding: 8px;
      margin-top: 15px;
      img {
        width: 22px;
        height: 22px;
      }
      p {
        width: calc(100% - 40px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 15px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        text-align: left;
        color: #404040;
      }
    }
    .model {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      padding: 15px;
      .model_l {
        width: 37%;
        height: 130px;
        background: url("../../../assets/img/home/woyaochongzhi.png") no-repeat;
        background-size: 100% 100%;
        p {
          font-size: 16px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: left;
          color: #503b1c;
          letter-spacing: -1px;
          margin: 15px;
        }
      }
      .model_r {
        width: 60%;
        height: 130px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
        .rt {
          width: 100%;
          height: 61px;
          background: url("../../../assets/img/home/yaoqinghaoyou.png")
            no-repeat;
          background-size: 100% 100%;

          p {
            font-size: 16px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: left;
            color: #1e4339;
            letter-spacing: -1px;
            margin: 5px 18px;
          }
        }
        .rb {
          width: 100%;
          height: 61px;
          background: url("../../../assets/img/home/jisuanqi.jpg") no-repeat;
          background-size: 100% 100%;
          p {
            font-size: 16px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: left;
            color: #2d3d60;
            letter-spacing: -1px;
            margin: 5px 18px;
          }
        }
      }
    }
    .list {
      background: #f7f8f9;
      padding: 10px 15px;
    }
    .cell {
      background: #ffffff;
      border-radius: 5px;
      box-shadow: 0px 2px 12px 2px rgba(0, 0, 0, 0.06);
      overflow: hidden;
      margin-top: 10px;
      position: relative;
      .cell_l {
        width: 25%;
        height: 100%;
        float: left;
        position: absolute;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .cell_r {
        width: calc(75% - 28px);
        margin-left: 16px;
        float: right;
        padding: 6px 12px;
        .title {
          font-size: 15px;
          font-family: PingFangSC, PingFangSC-Medium;
          font-weight: 500;
          text-align: left;
          color: #2f2f2f;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          margin-bottom: 5px;
        }
        .center {
          font-size: 11px;
          font-family: PingFangSC, PingFangSC-Medium;
          font-weight: 500;
          text-align: left;
          color: #82818f;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          span {
            color: red;
          }
        }
        .jindu {
          display: flex;
          flex-direction: row;
          justify-content: flex-start;
          align-items: center;
          margin: 7px 0 15px 0;
          .progressbox {
            width: 70%;
            height: 5px;
            background: #fef2f2;
            border-radius: 3px;
            position: relative;
            text-align: center;
            overflow: hidden;
            .progress {
              width: 40%;
              position: absolute;
              left: 0;
              top: 0;
              height: 5px;
              background: #ff674c;
              border-radius: 3px;
            }
          }
          span {
            font-size: 10px;
            font-family: PingFangSC, PingFangSC-Medium;
            font-weight: 500;
            text-align: left;
            color: #999999;
            margin-left: 4px;
          }
        }
        .tagbox {
          span {
            display: inline-block;
            background: #fdece3;
            border-radius: 2px;
            overflow: hidden;
            padding: 5px;
            margin-right: 5px;
            font-size: 11px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: left;
            color: #ff6f35;
          }
        }
      }
    }
  }
  .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    line-height: 150px;
    text-align: center;
    background-color: #39a9ed;
  }

  .swiper-container {
    z-index: 0;
    width: 100%;
    padding-top: 10px;

    .swiper-slide {
      background-position: center;
      background-size: cover;
      width: 80%;
      .swiper-img {
        border-radius: 10px;
        width: 100%;
        height: 160px;
      }
    }
  }
  .swiper-pagination {
    left: 50%;
    margin-left: -31px;
    /deep/.swiper-pagination-bullet {
      width: 16px;
      height: 2px;
      border-radius: inherit !important;
      background: #ff976a;
      margin-right: 5px;
    }
    /deep/.swiper-pagination-bullet-active {
      width: 16px;
      height: 2px;
      background: #ff5f46;
    }
  }
}
</style>